import { rawRequestClient } from '#/api/request';

// 组件接口类型定义
export interface Component {
  id?: number;
  name: string;
  description: string;
  agent_provider_id: number;
  version: string;
  input?: any;
  output?: any;
  created_at?: string;
  created_by?: string;
}

// 获取组件列表
export function getComponentList(params: {
  page?: number;
  size?: number;
  agent_provider_id?: number;
  version?: string;
  keyword?: string;
  order_by?: string;
}) {
  return rawRequestClient.get('/agent-provider-component', { params });
}

// 创建组件
export function createComponent(data: Omit<Component, 'id' | 'created_at' | 'created_by'>) {
  return rawRequestClient.post('/agent-provider-component', data);
}

// 更新组件
export function updateComponent(id: number, data: Omit<Component, 'id' | 'agent_provider_id' | 'created_at' | 'created_by'>) {
  return rawRequestClient.put(`/agent-provider-component/${id}`, data);
}

// 删除组件
export function deleteComponent(id: number) {
  return rawRequestClient.delete(`/agent-provider-component/${id}`);
}
